package com.icss.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import com.icss.model.ItemCategory;
@Component
public interface ItemCategoryDao {
	@Insert("insert into item_category values(default,#{name})")
	public int add(ItemCategory itemCategory);
	
	@Select("select id,name from item_category where id=#{id}")
	public ItemCategory findById(int id);
	
	@Select("select id,name from item_category limit #{start},#{pageSize}")
	public List<ItemCategory> findByPage(Map<String, Integer>map);
	
	@Select("select id,name from item_category")
	public List<ItemCategory> findAll();
	
	@Delete("delete from item_category where id=#{id}")
	public int del(int id);
	
	@Update("update item_category set name=#{name} where id=#{id}")
	public int update(ItemCategory i);
}
